home *** CD-ROM | disk | FTP | other *** search
- Path: navet.enator.se!usenet
- From: Robin Rosenberg <rrg@funsys.se>
- Newsgroups: comp.os.ms-windows.programmer.tools,com.os.ms-windows.programmer.tools.misc,comp.os.ms-windows.win95.misc,comp.lang.c++,
- Subject: Re: Reboot for Windows
- Date: Mon, 04 Mar 1996 00:58:48 -0800
- Organization: Enator Objective Management AB
- Message-ID: <313AB0C8.21D5@funsys.se>
- References: <4h46en$r9b@mn5.swip.net> <3136C5A3.3564@ftp.com>
- NNTP-Posting-Host: 194.18.172.178
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Joseph M. Koral wrote:
- >
- > Walter Lam wrote:
- >
- > > Does anyone know where I can get the source code, or executable for a PC
- > > reboot program under Windows? I've got one for dos, but it doesn't work
- > > under windows/windows 95......
- >
- > One possibilty might be to figure out how to call the Win95 reboot VxD yourself. Check out
- > Matt Pietrek's Win95 System Secrets book for more details.
- >
- > - Joseph
-
- It's very simple since windows has an API call for just this purpose. I create a file
- to tell autoexec that I didn't crash.
-
- #include <Windows.h>
-
- int
- PASCAL
- WinMain(HINSTANCE, HINSTANCE, LPSTR, int nCmdShow)
- {
- if (MessageBox(NULL/*owner window*/,
- "Vill du verkligen starta om systemet?",
- "Winboot",
- MB_ICONSTOP | MB_YESNO)==IDYES) {
- OFSTRUCT ofs = { sizeof(OFSTRUCT), TRUE, 0, {0,0,0,0}, "C:\\REBOOT.DAT"};
- HFILE f=_lcreat("C:\\REBOOT.DAT", 0);
- if (f) _lclose(f);
- ExitWindows(EW_REBOOTSYSTEM,0);
- }
- }
- }
-
- -- robin
-